#!/bin/bash
JSON=/Users/abyss/Dev/toys/lagou_practice/s3m2/json
if [ -n "$1" ] ;then
    do_date=$1
else
    do_date=`date -v-1d +%Y-%m-%d`
fi

echo $do_date
# 创建目录
hdfs dfs -mkdir -p /user/data/trade.db/product_category/dt=$do_date

# 数据迁移
python $DATAX_HOME/bin/datax.py -p "-Ddo_date=$do_date" $JSON/product_category.json

# 加载数据
hive -e "alter table trade.ods_trade_product_category add partition(dt='$do_date')"
